package com.itlong.cloud.property.resource;

import com.itlong.cloud.noncore.property.IPropertyOperatingReportServiceClient;
import com.itlong.cloud.property.service.IPropertyOperatingReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <desc>
 *      物业获取UI信息接口暴露。
 * <desc/>
 *
 * @createDate 2018-03-28.
 */
@RestController
public class PropertyOperatingReportServiceResource implements IPropertyOperatingReportServiceClient{

    @Autowired
    IPropertyOperatingReportService iPropertyOperatingReportService;

    /**
     * <desc>
     *      统计每天的缴费及欠费总额
     * </desc>
     *
     * @author Jiaqi.X
     * @createDate 2018/08/13
     */
    @Override
    @PostMapping(path = "/project/statistics/statisticsForDay")
    public void statisticsForMonth() throws Exception{
        iPropertyOperatingReportService.statisticsForMonth();
    }

    /**
     * <desc>
     *      统计每月的缴费及欠费总额
     * </desc>
     *
     * @author Jiaqi.X
     * @createDate 2018/08/13
     */
    @Override
    @PostMapping(path = "/project/statistics/statisticsForMonth")
    public void statisticsForYear() throws Exception{
        iPropertyOperatingReportService.statisticsForYear();
    }

    /**
     * <desc>
     *      获取项目下的报表信息
     * </desc>
     *
     * @param projectId
     * @param startTime
     * @param endTime
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/13
     */
    @Override
    @PostMapping(path = "/project/statistics/chargeStatistics")
    public Map<String,Object> chargeStatistics(@RequestParam("projectId") String projectId,@RequestParam("startTime")String startTime,
                                        @RequestParam("endTime") String endTime){
        return iPropertyOperatingReportService.chargeStatistics(projectId,startTime,endTime);
    }

    /**
     * <desc>
     *      统计物业增值运营分析数据
     * </desc>
     *
     * @createDate 2019/06/17
     * @author Jiaqi.X
     */
    @Override
    @PostMapping(path = "/project/statistics/statisticsAnalyseForMonth")
    public void statisticsAnalyseForMonth() throws Exception{
        iPropertyOperatingReportService.statisticsAnalyseForMonth();
    }
}
